// 用react 需要 使用render方法
import  React from './react'
class SubCounter {
    componmentDidMount(){
        console.log('child组件挂载完成');
    }
    componmentWillMount(){
        console.log('child组件将要挂在');
    }
    render(){
        return 123
    }
}
class Counter extends React.Component{
    constructor(props){
        super(props);
        this.state={number:1}
    }
    componmentDidMount(){
        console.log('parent组件挂载完成');
    }
    componmentWillMount(){
        console.log('parent组件将要挂在');
    }
    render(){
        return React.createElement(SubCounter, {name:123});
        // return this.state.number
    }
}
// function say() {
//         alert('say')
// }
// let element= React.createElement("div", {name: "xxx"}, "hello ",
//     React.createElement("button", {onClick:say}, "123"));
//jsx语法 =》虚拟dom 对象 类
React.render(React.createElement(Counter, {
    name: "zf"
}),document.getElementById('root'));